<?php  
  header("content-type:text/html;charset=utf-8");
  $corname  = trim($_POST["corname"]);  
  $linkname = trim($_POST["linkname"]);  
  $tel      = trim($_POST["tel"]);
  $mobile   = trim($_POST["mobile"]);  
  $email    = trim($_POST["email"]);  
  $province = trim($_POST["prv"]);
  $city     = trim($_POST["city"]);
  $address  = trim($_POST["address"]); 
  $type  = trim($_POST["type"]); 
  
  //判断表单值是否为空，并插入数据库  
  if (empty($corname) || empty($tel) || empty($linkname) || empty($type))
      {       
      exit("<script>alert('表单加*号的不能为空');window.history.back();</script>");
      }
  else
      {
      include("./inc/conn.php");
      $applytime = date("Y-m-d H:i:s");
      $sqlstr = "INSERT INTO ssq_applyinfo(corname, tel, linkname, mobile, email, province, city, address, applytime, type) 	VALUES('$corname', '$tel', '$linkname', '$mobile', '$email', '$province', '$city', '$address', '$applytime', '$type')";     
      $result = mysql_query($sqlstr);	 
      if (!$result)
          {
          exit("<script>alert('因为网络问题，申请错误啦');window.history.back();</script>");          
          }
      else
          {
          exit("<script>alert('您已成功注册，我们的客服人员将尽快的与您取得联系');window.location.href='./index.php';</script>");
          }
      }
  mysql_close($conn);
?>
